package com.zrrd.wemedia.controller.v1;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zrrd.model.common.dtos.ResponseResult;
import com.zrrd.model.wemedia.dtos.WmMaterialDto;
import com.zrrd.wemedia.service.WmMaterialService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author WanJl
 * @version 1.0
 * @title WmMaterialController
 * @description
 * @create 2023/9/20 15:49
 */
@RestController
@RequestMapping("/api/v1/material")
public class WmMaterialController {
    @Autowired
    private WmMaterialService wmMaterialService;

    @PostMapping("/upload_picture")
    public ResponseResult uploadPicture(MultipartFile multipartFile){
        return wmMaterialService.uploadPicture(multipartFile);
    }

    @PostMapping("/list")
    public ResponseResult findList(@RequestBody WmMaterialDto dto){
        return wmMaterialService.findList(dto);
    }



    @GetMapping("/collect/{id}")
    public ResponseResult collect(@PathVariable Integer id){
        return wmMaterialService.collect(id);
    }




    //http://127.0.0.1:8802/wemedia/MEDIA/wemedia/api/v1/material/cancel_collect/78
    @GetMapping("/cancel_collect/{id}")
    public ResponseResult cancelCollect(@PathVariable Integer id){
        return wmMaterialService.cancelCollect(id);
    }


    //http://127.0.0.1:8802/wemedia/MEDIA/wemedia/api/v1/material/del_picture/74
    @GetMapping("/del_picture/{id}")
    public ResponseResult delPicture(@PathVariable Integer id) {

        return wmMaterialService.delPicture(id);
    }
}
